package org.lemon.transport.coap.client;

import lombok.Data;
import org.eclipse.californium.core.observe.ObserveRelation;
import org.eclipse.californium.core.server.resources.CoapExchange;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * coap 观察者状态
 */
@Data
public class CoapObservationState {

    private final CoapExchange exchange;
    private final String token;
    private final AtomicInteger observeCounter = new AtomicInteger(0);
    private volatile ObserveRelation observeRelation;

    public CoapObservationState(CoapExchange exchange, String token) {
        this.exchange = exchange;
        this.token = token;
    }

    public CoapObservationState(CoapExchange exchange, String token, ObserveRelation observeRelation) {
        this.exchange = exchange;
        this.token = token;
        this.observeRelation = observeRelation;
    }
}
